/*     */ package com.lmpop.createIndex.search;
/*     */ 
/*     */ import com.lmpop.createIndex.searchModel.Queue;
/*     */ import com.lmpop.createIndex.searchModel.QueueValue;
/*     */ import com.lmpop.createIndex.searchModel.SearchData;
/*     */ import com.lmpop.createIndex.searchModel.SearchModel;
/*     */ import java.io.IOException;
/*     */ import java.text.ParseException;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class BizInfoIndexFiles
/*     */ {
/*     */   public ProperUtil properUtil;
/*     */   private String file_path;
/*     */ 
/*     */   public BizInfoIndexFiles()
/*     */   {
/*  22 */     this.properUtil = new ProperUtil();
/*  23 */     this.file_path = this.properUtil.getFilePathByModel("biz_info");
/*     */   }
/*     */ 
/*     */   public Map getOneBizInfo(String biz_id) throws IOException
/*     */   {
/*  28 */     SearchData search = new SearchData();
/*  29 */     ArrayList paraList = new ArrayList();
/*  30 */     paraList.add(new SearchModel("0", "biz_id", biz_id));
/*  31 */     return search.getSearchObject(this.file_path, paraList);
/*     */   }
/*     */ 
/*     */   public List getBizInfo(Map paraMap) throws IOException {
/*  35 */     ArrayList showList = new ArrayList();
/*  36 */     SearchData search = new SearchData();
/*  37 */     ArrayList paraList = new ArrayList();
/*     */ 
/*  39 */     String cat_id = ""; String keyword = ""; String state_code = ""; String search_date = ""; String orderby = "edit_date";
/*  40 */     String cust_name_check = ""; String contact_name_check = ""; String main_product_check = "";
/*  41 */     String e = ""; String f = ""; String g = ""; String area_id = ""; String biz_type = ""; String in_date = ""; String cust_id = ""; String content = ""; String units = ""; String mini_supply = "";
/*  42 */     String biz_price = ""; String rsrv_str4 = ""; String rsrv_str6 = "";
/*     */ 
/*  44 */     if (paraMap.get("cust_id") != null) cust_id = paraMap.get("cust_id").toString();
/*  45 */     if (paraMap.get("rsrv_str4") != null) rsrv_str4 = paraMap.get("rsrv_str4").toString();
/*  46 */     if (paraMap.get("rsrv_str6") != null) rsrv_str6 = paraMap.get("rsrv_str6").toString();
/*  47 */     if (paraMap.get("cat_id") != null) cat_id = paraMap.get("cat_id").toString();
/*  48 */     if (paraMap.get("area_id") != null) area_id = paraMap.get("area_id").toString();
/*  49 */     if (paraMap.get("e") != null) e = paraMap.get("e").toString();
/*  50 */     if (paraMap.get("f") != null) f = paraMap.get("f").toString();
/*  51 */     if (paraMap.get("g") != null) g = paraMap.get("g").toString();
/*  52 */     if (paraMap.get("state_code") != null) state_code = paraMap.get("state_code").toString();
/*  53 */     if (paraMap.get("keyword") != null) keyword = paraMap.get("keyword").toString();
/*  54 */     if (paraMap.get("biz_type") != null) biz_type = paraMap.get("biz_type").toString();
/*  55 */     if (paraMap.get("orderby") != null) orderby = paraMap.get("orderby").toString();
/*  56 */     if (paraMap.get("in_date") != null) in_date = paraMap.get("in_date").toString();
/*  57 */     if (paraMap.get("content") != null) content = paraMap.get("content").toString();
/*  58 */     if (paraMap.get("units") != null) units = paraMap.get("units").toString();
/*  59 */     if (paraMap.get("mini_supply") != null) mini_supply = paraMap.get("mini_supply").toString();
/*  60 */     Queue queue = new Queue(new QueueValue[] { new QueueValue(orderby, 2, true) });
/*     */ 
/*  62 */     paraList.add(new SearchModel("0", "cust_id", cust_id));
/*  63 */     paraList.add(new SearchModel("0", "rsrv_str4", rsrv_str4));
/*  64 */     paraList.add(new SearchModel("0", "rsrv_str6", rsrv_str6));
/*  65 */     paraList.add(new SearchModel("0", "cat_id", cat_id));
/*  66 */     paraList.add(new SearchModel("0", "class_attr", cat_id));
/*  67 */     paraList.add(new SearchModel("0", "area_attr", area_id));
/*  68 */     paraList.add(new SearchModel("0", "biz_type", biz_type));
/*     */ 
/*  70 */     paraList.add(new SearchModel("0", "e", e));
/*  71 */     paraList.add(new SearchModel("0", "f", f));
/*  72 */     paraList.add(new SearchModel("0", "g", g));
/*  73 */     paraList.add(new SearchModel("0", "title", keyword));
/*  74 */     paraList.add(new SearchModel("1", "in_date", in_date));
/*  75 */     paraList.add(new SearchModel("1", "biz_price", biz_price));
/*  76 */     paraList.add(new SearchModel("0", "state_code", state_code));
/*     */ 
/*  78 */     showList = search.getSearchInfo(this.file_path, paraList, queue);
/*  79 */     return showList;
/*     */   }
/*     */ 
/*     */   public ArrayList getTopClassStr(String up_cat_id, String class_type, ArrayList infoList)
/*     */   {
/*  84 */     ArrayList resultList = new ArrayList();
/*  85 */     CategoryIndexFiles CategoryIndex = new CategoryIndexFiles();
/*  86 */     ArrayList classList = new ArrayList();
/*     */     try {
/*  88 */       classList = CategoryIndex.getClassInfoList(class_type, up_cat_id);
/*     */     } catch (IOException e) {
/*  90 */       e.printStackTrace();
/*     */     }
/*  92 */     if ((classList != null) && (classList.size() > 0)) {
/*  93 */       Hashtable map = new Hashtable();
/*  94 */       for (int i = 0; i < classList.size(); i++) {
/*  95 */         map = (Hashtable)classList.get(i);
/*  96 */         String cat_id = ""; String cat_name = "";
/*  97 */         if (map.get("cat_id") != null) cat_id = map.get("cat_id").toString();
/*  98 */         if (map.get("cat_name") != null) cat_name = map.get("cat_name").toString();
/*  99 */         int cat_num = getClassNumByInfoList(cat_id, infoList);
/* 100 */         if (cat_num > 0) {
/* 101 */           TopNum topNum = new TopNum();
/* 102 */           topNum.setId(cat_id);
/* 103 */           topNum.setName(cat_name);
/* 104 */           topNum.setNum(cat_num);
/* 105 */           resultList.add(topNum);
/*     */         }
/*     */       }
/*     */     }
/* 109 */     return resultList;
/*     */   }
/*     */ 
/*     */   public int getClassNumByInfoList(String cat_id, ArrayList infoList)
/*     */   {
/* 114 */     int num = 0;
/* 115 */     if ((infoList != null) && (infoList.size() > 0)) {
/* 116 */       Hashtable map = new Hashtable();
/* 117 */       for (int i = 0; i < infoList.size(); i++) {
/* 118 */         map = (Hashtable)infoList.get(i);
/* 119 */         String class_attr = "";
/* 120 */         if (map.get("cat_id") != null) class_attr = map.get("cat_id").toString();
/* 121 */         if (class_attr.indexOf(cat_id) > -1) {
/* 122 */           num++;
/*     */         }
/*     */       }
/*     */     }
/* 126 */     return num;
/*     */   }
/*     */ 
/*     */   public ArrayList getSaleInfo(String cat_id, String area_code, String keyword, String state_code, String search_date)
/*     */     throws IOException, ParseException
/*     */   {
/* 134 */     return getSaleInfo("", cat_id, area_code, keyword, state_code, search_date);
/*     */   }
/*     */ 
/*     */   public ArrayList getSaleInfo(String cust_id, String cat_id, String area_code, String keyword, String state_code, String search_date) throws IOException, ParseException
/*     */   {
/* 139 */     ArrayList supplyList = new ArrayList();
/* 140 */     SearchData search = new SearchData();
/* 141 */     ArrayList paraList = new ArrayList();
/*     */ 
/* 143 */     Queue queue = new Queue(new QueueValue[] { new QueueValue("state_code", 2, true), new QueueValue("biz_id", 2, true) });
/* 144 */     paraList.add(new SearchModel("0", "cust_id", cust_id));
/* 145 */     paraList.add(new SearchModel("0", "class_attr", cat_id));
/* 146 */     paraList.add(new SearchModel("0", "area_attr", area_code));
/* 147 */     paraList.add(new SearchModel("1", "in_date", search_date));
/* 148 */     paraList.add(new SearchModel("2", keyword, new String[] { "title", "content" }));
/* 149 */     supplyList = search.getSearchInfo(this.file_path, paraList, queue);
/* 150 */     return supplyList;
/*     */   }
/*     */ 
/*     */   public ArrayList getTopAreaStr(String up_area_id, ArrayList infoList)
/*     */   {
/* 155 */     ArrayList resultList = new ArrayList();
/* 156 */     AreaIndexFiles areaIndex = new AreaIndexFiles();
/* 157 */     ArrayList areaList = new ArrayList();
/*     */     try {
/* 159 */       areaList = areaIndex.getAreaInfoList(up_area_id);
/*     */     } catch (IOException e) {
/* 161 */       e.printStackTrace();
/*     */     }
/* 163 */     if ((areaList != null) && (areaList.size() > 0)) {
/* 164 */       Hashtable map = new Hashtable();
/* 165 */       for (int i = 0; i < areaList.size(); i++) {
/* 166 */         map = (Hashtable)areaList.get(i);
/* 167 */         String area_id = ""; String area_name = "";
/* 168 */         if (map.get("area_id") != null) area_id = map.get("area_id").toString();
/* 169 */         if (map.get("area_name") != null) area_name = map.get("area_name").toString();
/*     */ 
/* 171 */         int area_num = getAreaNumByInfoList(area_id, infoList);
/* 172 */         if (area_num > 0) {
/* 173 */           TopNum topNum = new TopNum();
/* 174 */           topNum.setId(area_id);
/* 175 */           topNum.setName(area_name);
/* 176 */           topNum.setNum(area_num);
/* 177 */           resultList.add(topNum);
/*     */         }
/*     */       }
/*     */     }
/* 181 */     return resultList;
/*     */   }
/*     */ 
/*     */   public int getAreaNumByInfoList(String area_id, ArrayList infoList)
/*     */   {
/* 186 */     int num = 0;
/* 187 */     if ((infoList != null) && (infoList.size() > 0)) {
/* 188 */       Hashtable map = new Hashtable();
/* 189 */       for (int i = 0; i < infoList.size(); i++) {
/* 190 */         map = (Hashtable)infoList.get(i);
/* 191 */         String area_attr = "";
/* 192 */         if (map.get("area_attr") != null) area_attr = map.get("area_attr").toString();
/*     */ 
/* 195 */         if (area_attr.indexOf(area_id) > -1) {
/* 196 */           num++;
/*     */         }
/*     */       }
/*     */     }
/* 200 */     return num;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.createIndex.search.BizInfoIndexFiles
 * JD-Core Version:    0.6.0
 */